﻿Imports System.Data.OleDb
Imports System.Data
Namespace Arwani
    Partial Class Backend_ChangePassword
        Inherits System.Web.UI.Page

        Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
            Dim strQ As String = "select * from login where username='" & Request.Cookies("ADMIN_USER").Value & "' and password='" & Me.txtPasswordOld.Text.Replace("'", "") & "'"
            Dim arwCon As New ArwaniController
            Dim dtTable As DataTable = arwCon.ExecuteQuery(strQ)
            If dtTable.Rows.Count > 0 Then
                Dim strQ1 As String = "Update login set password='" & Me.txtPasswordNew.Text.Replace("'", "") & "' where username='" & Session("ADMIN_USER").ToString() & "' and password='" & Me.txtPasswordOld.Text.Replace("'", "") & "'"
                arwCon.ExecuteNonQuery(strQ1)
                Me.lblError.Style.Add("color", "green")

                Me.lblError.Text = "Password Changed successfully"
            Else
                Me.lblError.Style.Add("color", "red")
                Me.lblError.Text = "Invalid old password"
            End If
        End Sub

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                Me.txtPasswordOld.Text = String.Empty
            End If




        End Sub
    End Class
End Namespace